#ifndef SERIALVIEW_H
#define SERIALVIEW_H

#include "workspace.h"
#include "serial.h"
#include "ui_mainwindow.h"
#include <QObject>
#include <QSettings>
#include "glparse.h"
#include "testthread.h"

void recv_uart_farme(void);

class SerialView : public QObject
{
    Q_OBJECT
private:
    Ui::MainWindow *ui;
    TestThread testThread;
    GLParse *glParse;

    void serialRecvData(QByteArray recv);
    QList<QSerialPortInfo> serialPortInfo;
    void reflashSerialList(QList<QSerialPortInfo> serialList);
    void setOpenView();
    void setCloseView();
    void loadSettings();
    void saveSettings();
public:
    Serial serial;
    SerialView();
    void init(Ui::MainWindow *ui,GLParse *glParse);

private slots:
    void on_pushButtonReflashSerial_clicked();
    void on_pushButtonOpenSerial_clicked();
    void readDataSlot();
    void errorSlot(QSerialPort::SerialPortError error);


};

#endif // SERIALVIEW_H
